package com.zhao.modleclass.Jpuush;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by Administrator on 2016/11/11.
 */

public class JpushReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action=intent.getAction();
        if (action.equals(JPushInterface.ACTION_MESSAGE_RECEIVED)){
            //接收的自定义消息
            Bundle bundle=intent.getExtras();
            String message=bundle.getString(JPushInterface.EXTRA_MESSAGE);
            Log.i("TAG", "message: "+message);
        }else if (action.equals(JPushInterface.ACTION_NOTIFICATION_RECEIVED)){
            //接受的是富媒体或者通知的消息
            Bundle bundle=intent.getExtras();
            String extra=bundle.getString(JPushInterface.EXTRA_EXTRA);
            Log.i("TAG", "extra: "+extra);
        }
    }
}
